<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue</title>
    <script type="text/javascript" src="../../js/vue.js"></script>

</head>
<body>
    <div id="root">
        <!-- display  适用于频率高 -->
        <h2 v-show="show">欢迎{{name}}</h2>
        <hr>
        <h2>当前n的值：{{n}}</h2>
        <button @click="n++">点击n+1</button>
        <!-- display  适用于频率低，因为要操作dom -->
        <h2 v-if="n===1">happy{{name}}</h2>
        <h2 v-else-if="n===2">sad{{name}}</h2>
        <h2 v-else-if="n===3">nomal{{name}}</h2>
        <h2 v-else>haha{{name}}</h2>

        <!-- template 不破坏结构 -->
        <template v-if="n===1">
            <h2>你好</h2>
            <h2>zw</h2>
        </template>
        
    </div>

    <script type="text/javascript">
        Vue.config.performance = false;
        const vm = new Vue({
            el:'#root',
            data() {
                return {
                  name:'zw',
                  show:true,
                  n:0,
                };
            },
        })

    </script>

</body>
</html>